package kr.co.boogui.dao;

import java.util.List;

import mybatis3.helper.MVCSqlSessionFactory;

import org.apache.ibatis.session.SqlSession;

import kr.co.boogui.model.CinemaVO;
import kr.co.boogui.model.MovieVO;
import kr.co.boogui.model.ParamVO;

public class CinemaDAO {

	public static boolean insertCinema(CinemaVO c) {
		boolean result = false;
		SqlSession sess = null;		
		try {
			sess = MVCSqlSessionFactory.openSession();
			int i = sess.insert("CinemaMapper.insertCinemaSQL", c);
			sess.commit();
			if(i>0)result = true;
		} finally {
			sess.close();
		}		
		return result;
	}
	
	public static List<MovieVO> readCinemaInfo(String chartmn) {
		List<MovieVO> result = null;
		SqlSession sess = null;
		ParamVO pvo = new ParamVO();
		pvo.setChartmn(chartmn);
		try {
			sess = MVCSqlSessionFactory.openSession();
			result = sess.selectList("ReservationMapper.ReservationInfoSQL", pvo);			
		} finally {
			sess.close();
		}
		return result;
	}
	
}
